﻿using System;
using System.Collections.Generic;
using System.Xml;

namespace Landscape.Elements
{
    internal class Parameter
    {
        public string Name;
        public string Value;

        public Parameter(XmlReader source) {
            if (source.HasAttributes) {
                Name = source.GetAttribute("name");
                Value = source.GetAttribute("value");
            }

            if (string.IsNullOrEmpty(Name)) {
                throw new Exception("Attribute 'name' is missing or empty.");
            }

            if(string.IsNullOrEmpty(Value)){
                Value = source.ReadInnerXml();
            }
        }
    }
}
